#ifndef _SE_EVENT_
#define _SE_EVENT_

#include "Core/Logger.h"

namespace SE
{
	class Event
	{
	public:
		Boolean handled;

	public:
		Event() : handled(false) {}
		virtual ~Event() = default;
	};

	class EventDispatcher final
	{
	private:
		Event& mEvent;

	public:
		explicit EventDispatcher(Event& event) : mEvent(event) {}
		virtual ~EventDispatcher() = default;

		template<typename _Ty>
		Boolean dispatch(const EventHandler& handler)
		{
			if (dynamic_cast<const _Ty*>(&mEvent) != nullptr)
			{
				mEvent.handled |= handler(mEvent);
				return true;
			}
			return false;
		}
	};
} // !namespace SE

#endif // !_SE_EVENT_